Proper fix for iOS cropper being stuck #7194
Merged
+17
−15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #7191 and adds a proper fix.
The root problem is hinted at in the error message in ivpusic/react-native-image-crop-picker#1631:
We're trying to present the cropper from the picker but the picker is being dismissed — so it's not valid to present from. I'm not sure why this wasn't hitting us before but the problem makes sense.
The issue is how the cropper determines the controller to be presented from. It currently looks for the innermost controller, but it doesn't take it into account that the innermost controller might be animating out (and thus is not valid to present from). The fix is to add a condition for that.
Test Plan
Set an Xcode breakpoint on that line. Confirm that before the fix, it would select the picker controller as the "current" one, but after the fix, it selects the parent (as it should).
Verify all usages of the cropper:
fixx.mov